
#include <stdio.h>
int getCount(int m);
int main(void)
{
    int n; int a;
    int b; int m;
    scanf("%d", &n);

    int t;
    if (n!= -1)
    {
        m = n;
        a = getCount(n);
        while (n !=-1)
        {
            scanf("%d", &n);
            if(n==-1)
            {
                break;
            }
            b = getCount(n);
            if (a > b)
            {
                t = m; a = a;
            }
            else
            {
                t = n; a = b;
            }


        }
        printf("%d %d\n", t, a);

    }




    return 0;

}
int getCount(int m)
{
    int i;
    int count = 0;
    for (i = 1; i <=m; i++)
    {
        if (m % i == 0)
        {
            count++;

        }

    }
    return count;


}
